const Mock = require("mockjs");
module.exports = [
  //（四） 软件运行环境 监控
  {
    url: "/statusMonitor/getSoftRunEvn",
    type: "get",

    response: () => {
      // 生成当前时间及前几分钟的时间点
      const now = new Date();
      const timePoints = [0, 1, 3, 5].map((min) => {
        const d = new Date(now.getTime() - min * 60000);
        return `${d.getHours()}:${d.getMinutes().toString().padStart(2, "0")}`;
      });

      return Mock.mock({
        code: 200,
        msg: "操作成功",
        data: {
          sysRunTime: `${Mock.Random.integer(1, 24)}h`,
          cpuCoreNum: "8",
          memTotal: "31.2GB",
          memUsageRate: `${Mock.Random.float(0, 99).toFixed(2)}%`,
          cpuSysUsageAxis: {
            xData: [timePoints[0], timePoints[1]],
            yData: [Mock.Random.integer(50, 80), Mock.Random.integer(50, 80)],
          },
          netRateAxis: {
            xData: timePoints,
            yData: [
              [
                Mock.Random.float(10, 60),
                Mock.Random.float(10, 60),
                Mock.Random.float(10, 60),
                Mock.Random.float(10, 60),
              ],
              [
                Mock.Random.float(10, 60),
                Mock.Random.float(10, 60),
                Mock.Random.float(10, 60),
                Mock.Random.float(10, 60),
              ],
            ],
          },
          dataSourceAxis: {
            xData: [timePoints[0], timePoints[1]],
            yData: [Mock.Random.integer(45, 55), Mock.Random.integer(45, 55)],
          },
          cdisk: {
            total: "125.69GB",
            usage: `${Mock.Random.float(90, 99).toFixed(2)}%`,
          },
          ddisk: {
            total: "255.69GB",
            usage: `${Mock.Random.float(85, 95).toFixed(2)}%`,
          },
        },
      });
    },
  },
];
